import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { useAppStore } from './modules/app'
import { useLayoutStore } from './modules/layout.ts'
import { useAccountStore } from './modules/account.ts'
import { useProfileStore } from './modules/profile.ts'
import { useMemberStore } from './modules/member.ts'
import { useADStore } from './modules/ad.ts'
import { useSportsStore } from './modules/sports.ts'
import { useMatchStore } from './modules/match.ts'
import { useMarketStore } from './modules/market.ts'
import { useBetslipStore } from './modules/betslip.ts'
import { useCurrencyStore } from './modules/currency.ts'
import { useWalletStore } from './modules/wallet.ts'
import { useBettingConfigStore } from './modules/betting-config'
import { useFeedStore } from './modules/feed'
import { useActivityStore } from './modules/activity'
import { useSlotStore } from './modules/slot'
import { useCasinoStore } from './modules/casino'
import { useFollowStore } from './modules/follow'
import { useDialogStore } from './modules/dialog'
import { removeItem, setItem } from '@/utils'
import { useSearchGameStore } from './modules/searchGame'
import { useGameDetailStore } from './modules/game.ts'

export {
	useAppStore,
	useLayoutStore,
	useAccountStore,
	useProfileStore,
	useMemberStore,
	useADStore,
	useSportsStore,
	useMatchStore,
	useMarketStore,
	useBetslipStore,
	useCurrencyStore,
	useWalletStore,
	useBettingConfigStore,
	useFeedStore,
	useActivityStore,
	useSlotStore,
	useCasinoStore,
	useFollowStore,
	useDialogStore,
	useSearchGameStore,
	useGameDetailStore
}

const store = createPinia()

store.use(piniaPluginPersistedstate)

const stores = [
	// useAppStore,
	// useLayoutStore,
	// useAccountStore,
	useProfileStore,
	// useMemberStore,
	// useADStore,
	// useSportsStore,
	// useMatchStore,
	// useMarketStore,
	// useBetslipStore,
	useWalletStore,
	useActivityStore
	// useBettingConfigStore,
	// useFeedStore
]

export function resetAllStores() {
	stores.forEach((store) => {
		const initStore = store()
		initStore.$reset()
	})
}

export function resetAllStorages() {
	setItem('WALLET_TAB', 1)
	removeItem('MY_BETS_TAB')
	removeItem('PROFILE_TAB')
	removeItem('SPORTS_MY_BETS_TAB')
	removeItem('SLOTS_MY_BETS_TAB')
	removeItem('CASINO_MY_BETS_TAB')
	removeItem('DEPOSIT_TAB')
}

export default store
